<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<%@ page isELIgnored="false"%>
<html>
	<head>
		<title>评分模型7：超额增比递增法-SJH</title>
	</head>
<e:View id="eView" designProperty="width: 1024; height: 768">
	<script type="text/javascript" src="<c:url value='/scripts/global.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/js/perform/perform.js'/>"></script>
	
	<div id="Invisual Controls" style="min-height: 40px;" >
	<!-- 考核方案对应指标 -->
		<e:Dataset id="Dataset_project_index" datasetDefinition="DatasetDefinition_project.dsd" datasetRef="Dataset_project_index" pageSize="-1">
			<e:Field name="id" dataType="string" label="id" maxLength="32" />
			<e:Field name="projectId" dataType="string" label="考核方案ID" maxLength="32" />
			<e:Field name="indexId" dataType="string" label="指标ID" maxLength="32" />
			<e:Field name="baseScore" dataType="bigdecimal" label="基础分" maxLength="16" />
			<e:Field name="scoreModeId" dataType="string" label="评分模型ID" maxLength="32" />
			<e:Field name="formula" dataType="string" label="评分公式" maxLength="4000" />
		</e:Dataset>
	<!-- 评分数据模型 -->
		<e:Dataset id="Dataset_scoreParam" pageSize="1">
			<e:Field name="PARAM1" dataType="bigdecimal" format="#.##" label="分值" maxLength="" required="true" scale="2"/>
			<e:Field name="PARAM5" dataType="bigdecimal" format="#,###.##" label="完成率小于=XX" maxLength="" scale="2"/>
			<e:Field name="PARAM6" dataType="bigdecimal" format="#,###.##" label="得XX分" maxLength="" scale="2"/>
			<e:Field name="PARAM2" dataType="bigdecimal" format="#,###.##" label="每增加XX%" maxLength="" scale="2"/>
			<e:Field name="PARAM3" dataType="bigdecimal" format="#,###.##" label="加XX分" maxLength="" scale="2"/>
			<e:Field name="PARAM4" dataType="bigdecimal" format="#,###.##" label="加分不超过XX" maxLength="" scale="2"/>
			<e:Field name="formula" dataType="string" label="评分模型对以的初始函数" maxLength="4000" />
		</e:Dataset>
		
	<!-- 加载评分模型 -->
		<e:Command id="Command_loadScore" action="com.longtop.perform.kh.score.web.ScoreMainAction"
			method="loadScore">
			<e:DatasetInfo name="info1" dataset="Dataset_project_index" submitType="current"/>
			<e:DatasetInfo name="info2" dataset="Dataset_scoreParam" submitType="none" alwayRefreshClient="true" />
		</e:Command>
	<!-- 保存评分模型 -->
		<e:Command id="Command_save" action="com.longtop.perform.kh.score.web.ScoreMainAction"
			method="saveScore">
			<e:DatasetInfo name="info1" dataset="Dataset_project_index" submitType="current" alwayRefreshClient="true"/>
			<e:DatasetInfo name="info2" dataset="Dataset_scoreParam" />
		</e:Command>
	
	</div>

<body>
<e:Page id="ePage" action="" style="width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()" onBeforeLoadPage="ePage_onBeforeLoadPage()">
<table width="100%" border="0" align="center">
	<tbody>
		<tr>
			<td height="5"></td>
		</tr>
		<tr>
			<td width="">
			<e:GroupBox id="GroupBox" style="width:98%;height:200px;" caption="超额增比递增法">
			<table width="" border="0" align="center">
			  <tbody>
				<tr><td height="5" colspan="2"></td></tr>
				<tr>
					<td width="10" height="30" class="fonttitle">1、</td>
					<td class="fonttitle">任务完成，得基本分；</td>
				</tr>
				<tr>
					<td width="10" height="30" class="fonttitle">2、</td>
					<td class="fonttitle">任务未完成，完成率<=&nbsp;
					<e:Text id="PARAM5" dataset="Dataset_scoreParam" field="PARAM5" style="width:60px"/>
						&nbsp;%，&nbsp;&nbsp;得&nbsp;
					<e:Text id="PARAM6" dataset="Dataset_scoreParam" field="PARAM6" style="width:60px"/>&nbsp;分
					</td>
				</tr>
				<tr>
					<td width="10" height="30" class="fonttitle">3、</td>
					<td class="fonttitle">未完成，按比例得分；</td>
				</tr>
				<tr>
					<td width="10" height="30" class="fonttitle">4、</td>
					<td class="fonttitle">超额完成时，每增加&nbsp;
					<e:Text id="PARAM2" dataset="Dataset_scoreParam" field="PARAM2" style="width:60px"/>
					%&nbsp;,&nbsp;&nbsp;加&nbsp;
					<e:Text id="PARAM3" dataset="Dataset_scoreParam" field="PARAM3" style="width:60px"/>
					分&nbsp;&nbsp;加分不超过&nbsp;
					<e:Text id="PARAM4" dataset="Dataset_scoreParam" field="PARAM4" style="width:60px"/>分</td>
				</tr>
				<tr bgcolor="#E1EDF9"><td height="30" colspan="2" align="right">
					<e:Button id="Button_save" caption="保存" icon="images/submit.gif" onClick="Button_save_onClick()"/>
					&nbsp;&nbsp;<%--
					<e:Button id="button2" caption="关闭" icon="/images/close.gif" 
					onClick="MsgBox.showConfirmMsg('您确定要执行吗？', '执行确认', [closepage], []);"/>--%>
				</td></tr>
			  </tbody>
			</table>
			</e:GroupBox>
			</td>
		</tr>
	</tbody>
</table>
</e:Page>
</body>
<script type="text/javascript">
	//init:
	function ePage_onBeforeLoadPage(){
		//从父窗口加载考核数据:
		var record = parent.$J("Dataset_project_index").currentRecord;
		Dataset_project_index.clearData();
		var tmprecord = Dataset_project_index.insertRecord();
		Dataset_project_index.copyRecord(record,tmprecord,["indexName"]); //排除indexName字段
		
	}
	function ePage_onAfterLoadPage(){
		var scoreRecord = parent.$J("Dataset_scoreModel").currentRecord;
		if(scoreRecord){
			Dataset_project_index.setValue("scoreModeId",scoreRecord.getValue("scoreModeId"));//当前评分模型ID
			//加载评分数据：
			Command_loadScore.execute();
	
			if(Dataset_scoreParam.currentRecord == null){
				Dataset_scoreParam.insertRecord();
			}
			parent.$J("Text_baseScore").setValue(Dataset_scoreParam.getValue("PARAM1"));//显示基础分
			Dataset_scoreParam.setValue("formula",scoreRecord.getValue("formula"));	//当前评分模型公式
		}
	}
	//保存：
	function Button_save_onClick(){
		//取得当前的基本分,有基本分的对其做处理：
		var currentRate = parent.$J("Text_baseScore").getValue();
		Dataset_project_index.setValue("baseScore",currentRate);
		if(Dataset_scoreParam.getValue("PARAM1") != currentRate){
			Dataset_scoreParam.setValue("PARAM1",currentRate);
		}
		Command_save.execute();
		//父窗口ds保存基础分
		if(Command_save.getResponseStatus()){
			parent.$J("Dataset_project_index").setValue("baseScore",currentRate);
			parent.$J("Dataset_project_index").setValue("formula",Dataset_project_index.getValue("formula"));
		}
	}

</script>
</e:View>
</html>